#ifndef __MOTOR_H_
#define __MOTOR_H_

#include "stdint.h"
#include "can.h"

typedef struct
{
    uint16_t can_id;
    int16_t  set_voltage;
    uint16_t rotor_angle;
    int16_t  rotor_speed;
    int16_t  torque_current;
    uint8_t  temp;
}moto_info_t;


extern moto_info_t motor_info_GM6020[7];
extern moto_info_t motor_info_M3508_M2006[7];


#endif
void set_motor_voltage_M2006(uint8_t id_range, int16_t v1, int16_t v2, int16_t v3, int16_t v4);
void set_motor_voltage_M3508(uint8_t id_range, int16_t v1, int16_t v2, int16_t v3, int16_t v4);
void set_motor_voltage_GM6020_pitch(uint8_t id_range, int16_t v1, int16_t v2, int16_t v3, int16_t v4);
void set_motor_voltage_GM6020_yaw(uint8_t id_range, int16_t v1, int16_t v2, int16_t v3, int16_t v4);
void Set_chassis(uint8_t id_range, int16_t y_speed, int16_t x_speed , int16_t w_speed, uint8_t mode , uint8_t command );
void delay_us(uint16_t xus);
void delay_ms(uint16_t xms);
float motor_round_M2006(int16_t angle_new);
float motor_round_GM6020(float angle_new);
float motor_current(uint16_t current);
